/**
 * This class represents a Inters
 * -------------------------------
 * 
 * - Attributes dc and ds storing the values needed to verify the dependency.
 *  
 * @author
 * @version
 */
package model.constraints.inherited;

import java.util.ArrayList;

public class Inters {
	
	private String dc; // one data element
	private ArrayList<String> ds; // one OR MORE data element the ArrayList of String
	private String nodeName; // name of node

	public Inters() { }

	/**
	 * The constructor of dc and ds.
	 * @param inters 
	 * @return void
	 */
	public Inters(Inters i) {
		dc = new String(i.getDc());
		ds = new ArrayList<String>(i.getDs());
	}
	
	public void setDc(String element) {
		dc = element;
	}
	
	public void setDs(ArrayList<String> a) {
		ds = a;
	}
	
	public void setDs(String element, int position) {
		ds.set(position, element);
	}
	
	public String getDc() {
		return dc;
	}
	
	public ArrayList<String> getDs() {
		return ds;
	}
	
	/**
	 * This element method (string) in the array ds and returns the position of it.
	 * @param string element
	 * @return int the position of array
	 */
	public int findPositionDs(String element) {
		
		 for (int it=0; it<ds.size(); it++) {
		      if (ds.get(it).equals(element))
		    	  return it;   
		 }
		 
		 return -1;
	}
	
	/**
	 * Checks if arrays dc and ds are empty.
	 * @return true or false
	 */
	public Boolean isEmpty() {
		
		if (dc.isEmpty() && ds.isEmpty())
		    return true;
		
		return false;
	}
	
	public void setNodeName(String nodeName) {
		this.nodeName = nodeName;
	}

	public String getNodeName() {
		return nodeName;
	}	
	

	/**
	 * This function return String of dc and ds.
	 * @return string
	 */	
	public String toString() {
		String str = new String();
		str = ds.toString();
		str += dc.toString();
	    
		return str;
	}	
}
